<script setup lang="ts">
    import {ref,provide} from 'vue'
    import Child from './Child.vue'

    //希望将这个值传给孙组件
    let username = ref('tom')
    function changeUsername(v: string){
        username.value = v
    }

    let dog = ref('泰迪')

    //在祖先组件中通过`provide`配置向后代组件提供数据
    provide('username-options',{username,changeUsername})
    provide('dog-options',dog)
</script>
<template>
    <h1>provides-inject-父组件-{{username}}-{{ dog }}</h1>
    <hr>
    <Child/>
</template>
<style scoped>
   
</style>